package com.up.management.domain.dto;

import com.up.common.core.domain.BaseEntity;

/**
 * 评论管理数据传输对象 DTO
 * 用于Controller入参与Service接收
 */
public class EventCommentDTO extends BaseEntity {
    private Long commentId;
    private Long eventId;
    private Long userId;
    private Long parentId;
    private Long topId;
    private String content;
    private Long status;
    private String parentContent;

    // 查询：活动名称、用户名
    private String eventName;
    private String username;

    public Long getCommentId() { return commentId; }
    public void setCommentId(Long commentId) { this.commentId = commentId; }

    public Long getEventId() { return eventId; }
    public void setEventId(Long eventId) { this.eventId = eventId; }

    public Long getUserId() { return userId; }
    public void setUserId(Long userId) { this.userId = userId; }

    public Long getParentId() { return parentId; }
    public void setParentId(Long parentId) { this.parentId = parentId; }

    public Long getTopId() { return topId; }
    public void setTopId(Long topId) { this.topId = topId; }

    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }

    public Long getStatus() { return status; }
    public void setStatus(Long status) { this.status = status; }

    public String getParentContent() { return parentContent; }
    public void setParentContent(String parentContent) { this.parentContent = parentContent; }

    public String getEventName() { return eventName; }
    public void setEventName(String eventName) { this.eventName = eventName; }

    public String getUsername() { return username; }
    public void setUsername(String username) { this.username = username; }

    // 转换为实体
    public com.up.management.domain.entity.EventComment toEntity() {
        com.up.management.domain.entity.EventComment e = new com.up.management.domain.entity.EventComment();
        e.setCommentId(this.getCommentId());
        e.setEventId(this.getEventId());
        e.setUserId(this.getUserId());
        e.setParentId(this.getParentId());
        e.setTopId(this.getTopId());
        e.setContent(this.getContent());
        e.setStatus(this.getStatus());
        e.setParentContent(this.getParentContent());
        // 传递查询辅助字段
        e.setEventName(this.getEventName());
        e.setUsername(this.getUsername());
        e.setCreateBy(this.getCreateBy());
        e.setCreateTime(this.getCreateTime());
        e.setUpdateBy(this.getUpdateBy());
        e.setUpdateTime(this.getUpdateTime());
        e.setRemark(this.getRemark());
        return e;
    }

    // 从实体填充
    public static EventCommentDTO fromEntity(com.up.management.domain.entity.EventComment e) {
        if (e == null) return null;
        EventCommentDTO dto = new EventCommentDTO();
        dto.setCommentId(e.getCommentId());
        dto.setEventId(e.getEventId());
        dto.setUserId(e.getUserId());
        dto.setParentId(e.getParentId());
        dto.setTopId(e.getTopId());
        dto.setContent(e.getContent());
        dto.setStatus(e.getStatus());
        dto.setParentContent(e.getParentContent());
        dto.setEventName(e.getEventName());
        dto.setUsername(e.getUsername());
        dto.setCreateBy(e.getCreateBy());
        dto.setCreateTime(e.getCreateTime());
        dto.setUpdateBy(e.getUpdateBy());
        dto.setUpdateTime(e.getUpdateTime());
        dto.setRemark(e.getRemark());
        return dto;
    }
}